package com.yesjpt.conf;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;

import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.web.servlet.ServletContextInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.util.WebAppRootListener;

import com.yesjpt.util.L;

@Configuration
@ComponentScan
@EnableAutoConfiguration
public class WebSocketMaxMsgSizeConfig implements ServletContextInitializer {
	@Override
	public void onStartup(ServletContext servletContext) throws ServletException {
		L.info(new Throwable().getStackTrace()[0] + "，正在配置WebSocket大包的问题，设置大小为：10M");
		servletContext.addListener(WebAppRootListener.class);
		servletContext.setInitParameter("org.apache.tomcat.websocket.textBufferSize", "1024000");
	}

}
